import Vue from 'vue'
import VueRouter from 'vue-router'
import lyf from '../components/lyf/lyf.vue'
import login from '../components/login.vue'
import home from '../components/home.vue'
import welcome from '../components/welcome.vue'
import stack from '../components/lyf/stack.vue'
import users from '../components/hlx/hlx_users.vue'
import orders from '../components/orders.vue'
import reports from '../components/show/reports.vue'
import zxl from '../components/zxl/zxl.vue'
import zmy from "../components/zmy.vue"

Vue.use(VueRouter)

const routes = [
  {
    path: '/lyf',
    component: lyf
  },
  {
    path: "/",
    redirect: '/login'  //重定向，当请求地址是/的时候，将当前路由地址直接跳转到/login
  },
  {
    path: '/login',
    component: login
  },
  {
    path: '/home',
    component: home,
    redirect: '/welcome',   //重定向 ,当请求地址是 /home 时
    children: [
      {
        path: '/welcome',
        component: welcome
      },
      {
        path: '/stack',
        component: stack
      },
      {
        path: '/users',
        component: users
      },
      {
        path: '/orders',
        component: orders
      },
      {
        path: '/reports',
        component: reports
      },
      {
        path: '/goods',
        component: zxl
      }, 
      {
        path: "/categories",
        component: zmy
      }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
